<!-- 主页面 -->
<template>
  <div class="app" style="max-width:750px; margin:0 auto;" >
    <router-view />
    <div class="hanter" style="max-width:750px; margin:0 auto;">
      <div class='history_div_box' @click="withdraw">{{ this.$route.path == '/clockIn' ? '退出' :  '返回'}} </div>
      <div class=''>{{ $route.meta.title }} </div>
      <div class='history_div_box' style="  opacity: 0;" ><span v-if="this.$route.path == '/about'">获取</span><span v-else>历史</span></div>
    </div>
  </div>
</template>
<script>
// @ is an alias to /src
export default {
  name: "HomeView",
  data() {
    return {
      /** tabbar默认高亮 */
      active: 0,
    };
  },
  created() {},
  methods: {
    /**
     * 左按钮
     */
    onClickLeft() {
      this.$router.go(-1);
    },
    /**
     * 右按钮
     */
    onClickRight() {
      this.$router.push('/about')
    },
    // 退出按钮
    withdraw(){
      if (this.$route.path == '/clockIn') {
        this.$router.push('/logon')
      localStorage.removeItem('ALB_H5_USER')
      localStorage.removeItem('ALB_H5_TOKEN')
      } else {
        this.$router.go(-1);
      }
     
    },
    /**
     * 跳转个人信息
     */
    // toPersonalInformation() {
    //   if (this.$route.path == '/information') return
    //   this.$router.push('/information')
    // },
    /**
     * 跳转首页
     */
    // toHome() {
    //   if (this.$route.path == '/home') return
    //   this.$router.push('/')
    // },
    /**
     * 跳转历史
     */
    toAbout() {
      if (this.$route.path == '/about') {
        if (this.$route.path == '/clockIn') return
        this.$router.push('/clockIn')
      }else{
        if (this.$route.path == '/about') return
        this.$router.push('/about')
      }
    },
    /**
     * 打卡
     */
    //  clockInClcik(){
    //   if (this.$route.path == '/clockIn') return
    //   this.$router.push('/clockIn')
    //  },
  },
};
</script>
<style scoped >
.hanter{
    width: 95vw;
    position: relative;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    height: .3rem;
    font-size: .15rem;
    justify-content: space-between;
    color: #fff;
    margin: 0 auto;
}
.history_div_box{
  cursor: pointer;
}
</style>
